{% extends 'admin/base_admin.html' %}
{% block title %}{{ _('客户查询') }}{% endblock %}
{% block content %}
<form method="get" class="mb-4 flex gap-2">
  <input name="q" value="{{ q }}" placeholder="{{ _('输入ID或用户名') }}" class="border rounded p-2 w-64">
  <button class="px-3 py-2 rounded bg-emerald-600 text-white">{{ _('搜索') }}</button>
</form>

<table class="w-full text-sm border">
  <thead><tr>
    <th class="p-2">ID</th>
    <th class="p-2">{{ _('用户名') }}</th>
    <th class="p-2">{{ _('邮箱') }}</th>
    <th class="p-2">{{ _('创建时间') }}</th>
    <th class="p-2">{{ _('操作') }}</th>
  </tr></thead>
  <tbody>
  {% for u in items %}
  <tr class="border-t">
    <td class="p-2 font-mono">{{ u.id }}</td>
    <td class="p-2">{{ u.username }}</td>
    <td class="p-2">{{ u.email }}</td>
    <td class="p-2">{{ u.created_at }}</td>
    <td class="p-2"><a class="text-emerald-700" href="{{ url_for('front.account_profile') }}?uid={{ u.id }}" target="_blank">{{ _('查看') }}</a></td>
  </tr>
  {% endfor %}
  </tbody>
</table>

<div class="mt-4 flex gap-2">
  {% if pagination.has_prev %}
    <a class="px-3 py-1 border rounded" href="?q={{ q }}&page={{ pagination.prev_num }}">{{ _('上一页') }}</a>
  {% endif %}
  <span class="px-3 py-1">{{ pagination.page }}/{{ pagination.pages }}</span>
  {% if pagination.has_next %}
    <a class="px-3 py-1 border rounded" href="?q={{ q }}&page={{ pagination.next_num }}">{{ _('下一页') }}</a>
  {% endif %}
</div>
{% endblock %}
